package cn.piesat.scanning.service.impl;

import cn.piesat.scanning.dao.DbDmsProductDistributeRecodeDAO;
import cn.piesat.scanning.dto.DbDmsProductDistributeRecodeDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DbDmsProductDistributeRecodeServiceImpl implements cn.piesat.scanning.service.DbDmsProductDistributeRecodeService {

    private static final Logger logger = LoggerFactory.getLogger(DbDmsProductDistributeRecodeServiceImpl.class);

    @Autowired
    private DbDmsProductDistributeRecodeDAO dbDmsProductDistributeRecodeDAO;

    @Override
    public void addEntity(DbDmsProductDistributeRecodeDTO dto) {
        try {
            dbDmsProductDistributeRecodeDAO.save(dto);
        }catch (Exception e) {
            logger.error("产品分发记录保存失败{}",e.getLocalizedMessage(),e);
        }
    }

    @Override
    public List<DbDmsProductDistributeRecodeDTO> findByFtpAndFileName(String host, String filename) {
        return dbDmsProductDistributeRecodeDAO.findByDistriTargetIpAndFileName(host,filename);
    }

}
